{% extends 'base.html' %}
{% block content %}
    <form class="form-horizontal" role="form" method="post" action="/chgUser/" >
        <fieldset >
            <legend>修改用户信息</legend>
            {% if error %}
                <div class="alert alert-danger">
                    {{ error }}
                </div>
            {% endif %}

            {% if form.errors %}
                <div class="alert alert-danger">
                     Please correct the error{{ form.errors|pluralize }} below.
                </div>
            {% endif %}

            {% if msg %}
                <div class="alert alert-success">
                    {{ msg }}
                </div>
            {% endif %}
            <div class="form-group">
                <label for="username" class="col-sm-2 control-label">用户名<span style="color: red"> *</span></label>
                <div class="col-sm-4">
                    <input type="text" id="username" name="username" class="form-control" value="{{ user.username }}" readOnly="readOnly">
                </div>
            </div>
            <div class="form-group">
                <label for="password" class="col-sm-2 control-label">密码<span style="color: red"> *</span></label>
                <div class="col-sm-4">
                   <a href="/chgPass/?username={{ user.username }}">修改密码</a>
                </div>
            </div>
            <div class="form-group">
                <label for="key_pass" class="col-sm-2 control-label">密钥密码<span style="color: red"> *</span></label>
                <div class="col-sm-4">
                    <a href="/chgKey/?username={{ user.username }}">修改密码</a>
                </div>
            </div>
            <div class="form-group">
                <label for="name" class="col-sm-2 control-label">姓名<span style="color: red"> *</span></label>
                <div class="col-sm-4">
                    <input type="text" id="name" name="name" class="form-control" value="{{ user.name }}" >
                </div>
            </div>
            <div class="form-group">
                <label for="group" class="col-sm-2 control-label">属组<span style="color: red"> *</span></label>
                <div class="col-sm-4">
                    <select multiple name="group" id="group" class="form-control">
                        {% for group in groups %}
                        <option value="{{ group.name }}" >{{ group.name }}</option>
                        {% endfor %}
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label for="is_admin" class="col-sm-2 control-label">组admin</label>
                <div class="col-sm-4">
                    <input type="radio" name="is_admin" id="is_admin" value="1">
                </div>
            </div>
            <div class="form-group">
                <label for="is_superuser" class="col-sm-2 control-label">超级admin</label>
                <div class="col-sm-4">
                    <input type="radio" name="is_superuser" id="is_superuser" value="1">
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-4">
                    <button class="btn btn-primary">修改</button>
                </div>
            </div>
        </fieldset>
    </form>
{% endblock %}